package com.example.demo.controller;

import com.example.demo.entity.Order;
import com.example.demo.entity.User;
import com.example.demo.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderMapper orderMapper;

    @GetMapping("/getOrderList")
    public List query(){
        List<Order> list = orderMapper.selectList(null);
        return list;
    }

    //通过订单查询对应的用户
    @GetMapping("/findAll")
    public List findAll(){
        List orders = orderMapper.selectAllOrdersAndUser();
        return orders;
    }
}
